package cc.rengu.redp.bizimpl.csmc.service.impl;

import cc.rengu.redp.bizimpl.csmc.common.CsmcConstant;
import cc.rengu.redp.bizimpl.csmc.domain.CSysParam;
import cc.rengu.redp.bizimpl.csmc.dao.CSysParamMapper;
import cc.rengu.redp.bizimpl.csmc.service.ICSysParamService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lizk
 */
@Service
@DS("csmc")
public class CSysParamServiceImpl extends ServiceImpl<CSysParamMapper, CSysParam> implements ICSysParamService {


    @Override
    public List<CSysParam> getListByInstIdAndParamType(String type) {
        LambdaQueryWrapper<CSysParam> wrapper =new LambdaQueryWrapper<>();
        wrapper.eq(CSysParam::getInstId, "*").eq(CSysParam::getParamStatus, CsmcConstant.SYS_ParamStatus);
        if ("bizProdList".equals(type)){
            wrapper.eq(CSysParam::getParamType, CsmcConstant.SYS_BIZ_PROD_TYPE);
        }else if ("dzRsltList".equals(type)){
            wrapper.eq(CSysParam::getParamType, CsmcConstant.SYS_RECON_RSLT_TYPE);
        }else if ("payAcctList".equals(type)){
            wrapper.eq(CSysParam::getParamType, CsmcConstant.SYS_PAY_ACCT_TYPE);
        }else if ("transChannelList".equals(type)){
            wrapper.eq(CSysParam::getParamType, CsmcConstant.SYS_TRANS_CHANNEL_TYPE);
        }else if ("payChannelList".equals(type)){
            wrapper.eq(CSysParam::getParamType, CsmcConstant.SYS_PAY_CHANNEL_TYPE);
        }

        return baseMapper.selectList(wrapper);
    }
}
